package com.tech.service.impl;

import com.tech.repository.entity.Order;
import com.tech.mapper.OrderDao;
import com.tech.mapper.factory.DaoImplFactory;

/**
 * 订单服务类
 */
@Deprecated
public class OrderServiceOld {
	private OrderDao orderDao = DaoImplFactory.getOrderDao();

	/**
	 * 生成订单
	 *
	 * @param order 新订单数据
	 * @return 生成的订单ID(编号)
	 */
	public int createOrder(Order order) {
		return orderDao.addOrder(order);
	}

	/**
	 * 更新订单支付状态
	 *
	 * @param orderId  订单ID
	 * @param newState 新的订单状态
	 * @return 数据是否发生更改
	 */
	public boolean updateOrderState(int orderId, Order.OrderState newState) {
		return orderDao.updateOrderState(orderId, newState.toString());
	}

	public Order getOrder(int buyerId, int goodsId) {
		return orderDao.getOrder(buyerId, goodsId);
	}

}
